#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct node
{
    unsigned int xh;
    char xm[20];
    double cj[3];
    double pj;
    double all;
    struct node* next;
}LNode;

void Listpushback(LNode** phead,unsigned int xh1,char *xm1,double* cj1)
{
    LNode* newnode;
    newnode=(LNode*)malloc(sizeof(LNode));
    newnode->xh=xh1;
    strcpy((newnode->xm),xm1);
    double s=0;
    for(int i=0;i<3;i++)
    {
        newnode->cj[i]=cj1[i];
        s+=cj1[i];
    }
    newnode->all=s;
    s/=3;
    newnode->pj=s;
    if(*phead==NULL)
    {
        newnode->next=*phead;
        *phead=newnode;
    }
    else
    {
        LNode* tail=*phead;
        while(tail->next!=NULL)
        {
            tail=tail->next;
        }
        newnode->next=NULL;
        tail->next=newnode;
    }
}
void Listsetin(LNode** phead,unsigned int xh1,char *xm1,double* cj1)
{
    LNode* newnode;
    newnode=(LNode*)malloc(sizeof(LNode));
    newnode->xh=xh1;
    strcpy((newnode->xm),xm1);
    double s=0;
    for(int i=0;i<3;i++)
    {
        newnode->cj[i]=cj1[i];
        s+=cj1[i];
    }
    newnode->all=s;
    s/=3;
    newnode->pj=s;
    if((newnode->xh)<((*phead)->xh))
    {
        newnode->next=*phead;
        *phead=newnode;
        return;
    }
    else
    {
        LNode* tail=(*phead)->next;
        LNode* prev=*phead;
        while(tail)
        {
            if(((tail->xh)>(newnode->xh))&&((prev->xh)<(newnode->xh)))
            {
                prev->next=newnode;
                newnode->next=tail;
                return;
            }
            prev=tail;
            tail=tail->next;
        }
        if(tail==NULL)
        {
            prev->next=newnode;
            return;
        }
    }
}
int main()
{
    int n;
    unsigned int xh1;
    char xm1[20];
    double cj1[3];
    while(scanf("%d",&n)!=EOF)
    {
        LNode* plist;
        plist=NULL;
        for(int i=0;i<n;i++)
        {
            scanf("%d",&xh1);
            scanf("%s",xm1);
            for(int j=0;j<3;j++)
            {
                scanf("%lf",&cj1[j]);
            }
            Listpushback(&plist,xh1,xm1,cj1);
        }
        scanf("%d",&xh1);
        scanf("%s",xm1);
        for(int j=0;j<3;j++)
        {
            scanf("%lf",&cj1[j]);
        }
        Listsetin(&plist,xh1,xm1,cj1);
        LNode* cur=plist;
        while(cur!=NULL)
        {
            printf("%d  ",cur->xh);
            printf("%s  ",cur->xm);
            for(int j=0;j<3;j++)
            {
                printf("%.2lf  ",cur->cj[j]);
            }
            printf("%.2lf  ",cur->pj);
            printf("%.2lf\n",cur->all);
            cur=cur->next;
        }
    }
    return 0;
}
